package ch8.ex1;

import static ch8.print.Print.*;

public class RodentTest {
	public static void main(String... args){
		Rodent[] r = new Rodent[]{
				new Mouse(),
				new Gerbil(),
				new Hamster()
		};
		
		for(Rodent rr:r){
			rr.hop();
			rr.scurry();
			rr.reproduce();
			println(rr);
		}
	}
}

abstract class Rodent{
	public abstract void hop();
	public abstract void scurry();
	public abstract void reproduce();
}

class Mouse extends Rodent{

	public void hop() {
		println("Mouse hopping");
	}

	public void scurry() {
		println("Mouse scurring");
	}

	public void reproduce() {
		println("Making more Mice");
	}
	
	public String toString(){
		return "Mouse";
	}
}

class Gerbil extends Rodent {
	public void hop() {
		println("Gerbil hopping");
	}

	public void scurry() {
		println("Gerbil scurring");
	}

	public void reproduce() {
		println("Making more Gerbils");
	}
	
	public String toString(){
		return "Gerbil";
	}
}

class Hamster extends Rodent{
	public void hop() {
		println("Hamster hopping");
	}

	public void scurry() {
		println("Hamster scurring");
	}

	public void reproduce() {
		println("Making more Hamsters");
	}
	
	public String toString(){
		return "Hamster";
	}
}